using System;
using System.Collections.Generic;
using Jalal.Library.DataStructure;
using BCGC.BLL.Helper;
using Jalal.Library.Data;
using BCGC.DAL;
namespace BCGC.BLL.BusinessObject.Poll
{

    public class PollEvent
    {

        private int id;
        public int Id
        {
            get
            {
                return id;
            }
        }

        private int questionId;
        public int QuestionId
        {
            get
            {
                return questionId;
            }
        }

        private PollQuestion question;
        public PollQuestion Question
        {
            get
            {
                if (question == null)
                {
                    question = PollQuestion.GetPollQuestionById(QuestionId);
                }
                return question;
            }
        }

        private DateTime startDateTime;
        public DateTime StartDateTime
        {
            get
            {
                return startDateTime;
            }
        }

        private DateTime endDateTime;
        public DateTime EndDateTime
        {
            get
            {
                return endDateTime;
            }
            set
            {
                endDateTime = value;
            }
        }

        private bool isCurrentPollQuestion;
        public bool IsCurrentPollQuestion
        {
            get
            {
                return isCurrentPollQuestion;
            }
            set
            {
                isCurrentPollQuestion = value;
            }
        }

        public static PollEvent Create(PollQuestion question, DateTime startDateTime, DateTime endDateTime)
        {
            throw new System.Exception("Not implemented");
        }

        public static void Create(int questionId, DateTime startDateTime, DateTime endDateTime)
        {
            DataFactory.GetDataMiner().BeginTransaction(true);
            PollData.CreatePollEvent(questionId, startDateTime, endDateTime);
            DataFactory.GetDataMiner().CommitTransaction();
        }

        public static void Delete(PollEvent pollEventToDelete)
        {
            throw new System.Exception("Not implemented");
        }

        public static void Delete(List<PollEvent> pollEventsToDelete)
        {
            throw new System.Exception("Not implemented");
        }

        public static void Delete(List<int> pollEventIdsToDelete)
        {
            throw new System.Exception("Not implemented");
        }

        public void Delete()
        {
            throw new System.Exception("Not implemented");
        }

        public void Update()
        {
            throw new System.Exception("Not implemented");
        }

        public static PollEvent GetCurrentPollEvent()
        {
            throw new System.Exception("Not implemented");
        }

        public static int GetPollEventById(int id)
        {
            throw new System.Exception("Not implemented");
        }

        public static bool IsOverlap(DateTime startDateTime, DateTime endDateTime)
        {
            DataFactory.GetDataMiner().BeginTransaction(true);
            bool result = (PollData.PollEventDateOverlapCount(startDateTime, endDateTime) > 0);
            DataFactory.GetDataMiner().CommitTransaction();
            return result;
        }
    }
}
